package com.soulkun.smarthome.ui.main.home.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.soulkun.smarthome.logic.dto.DeviceQRCodeDTO
import com.soulkun.smarthome.logic.model.DeviceModel
import com.soulkun.smarthome.logic.model.ResponseModel
import com.soulkun.smarthome.logic.model.RoomModel
import com.soulkun.smarthome.logic.repository.ApiRepository

class AppMainHomeAddDeviceViewModel: ViewModel() {

    val flashLightOnLiveData = MutableLiveData<Boolean>(false)
    val roomLiveData = MutableLiveData<RoomModel>()
    val deviceQRCodeLiveData = MutableLiveData<DeviceQRCodeDTO>()
    val deviceNameEditLiveData = MutableLiveData<String>("")

    fun addRoomDevice(deviceName: String): LiveData<Result<ResponseModel<Any>>> {
        return ApiRepository.addDevice(DeviceModel(deviceQRCodeLiveData.value!!.deviceId, deviceName, deviceQRCodeLiveData.value!!.productId, roomLiveData.value!!.familyId, roomLiveData.value!!.id))
    }

}